package com.distribute.application.api.utils;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;


public class MainClass {
	
	public static void main(String[] args) {
		 ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript");
		String ddString="-1.17509656E-22*Math.pow({A1},6)+1.244978219333E-18*Math.pow({A1},5)-3.41752276522394E-15*Math.pow({A1},4)-1.08611167104575E-11*Math.pow({A1},3)+1.19973853575719E-07*Math.pow({A1},2)-3.04110364623966E-06*Math.pow({A1},1)+0.000344332464464969";
		//String ddString1="(-1.17509656E-22*Math.pow(597,6)+1.244978219333E-18*Math.pow(597,5)-3.41752276522394E-15*Math.pow(597,4)-1.08611167104575E-11*Math.pow(597,3)+1.19973853575719E-07*Math.pow(597,2)-3.04110364623966E-06*Math.pow(597)+ 0.000344332464464969)*100";
		
		try {
			//System.out.println(jse.eval(ddString1).toString());
			System.out.println(ddString.replace("{A1}", ""+597));
			System.out.println(jse.eval(ddString.replace("{A1}", ""+597)).toString());
		} catch (ScriptException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	 

}
